﻿using System;
using Monkey.Framework.Configuration;
using log4net.Config;
using log4net;

namespace Monkey.Framework.Logging
{
    public class Log4NetAdapter : ILogger
    {
        private readonly log4net.ILog _log;

        /// <summary>
        /// Initializes a new instance of the <see cref="Log4NetAdapter"/> class.
        /// </summary>
        public Log4NetAdapter()
        {
            XmlConfigurator.Configure();
            _log = LogManager
             .GetLogger(ApplicationSettings.LoggerName);
        }

        /// <summary>
        /// Logs the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        public void Log(string message)
        {
            try
            {
                _log.Info(message);
            }
            catch(Exception ex)
            {
            }
        }
    }

}
